<template>
  <TitleMode
    title="动态"
    :more="trendsList.length > 0 ? '全部' : ''"
    id="trends"
    @more="to('/pages-sub/artist/trend-list', { id: artist.id })"
  />
  <div class="list" v-if="trendsList.length > 0">
    <Tend v-for="(item, index) in trendsList" :key="index" :data="item"></Tend>
  </div>
  <Seat v-else height="260px" size="mini" :loading="loading" />
</template>
<script setup lang="ts">
import { to } from '@/utils/page'
import TitleMode from './TitleMode.vue'
import Tend from '@/pages-sub/g-components/Trend/index.vue'

defineOptions({ name: 'Trends' })
const props = defineProps(['artist'])
const loading = ref(false)

const trendsList = ref([])
if (props.artist.id) {
  getData()
}
function getData() {
  loading.value = true
  http
    .get('/posts-info-app/open/page', {
      createUser: props.artist.id,
      current: 1,
      size: 5,
    })
    .then((res: any) => {
      trendsList.value = res.records
    })
    .finally(() => {
      loading.value = false
    })
}
</script>
<style lang="scss" scoped></style>
